import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/blade-resource/attach/page-by-condition',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

export const getDetail = (id) => {
  return request({
    url: '/api/blade-resource/attach/detail',
    method: 'get',
    params: {
      id
    }
  });
};

// export const getAttachType = (params) => {
//   return request({
//     url: '/api/blade-system/dict/dictionary',
//     method: 'get',
//     params
//   });
// };

export const remove = (ids) => {
  return request({
    url: '/api/blade-resource/attach/remove',
    method: 'post',
    params: {
      ids
    }
  });
};

export const add = (row) => {
  return request({
    url: '/api/blade-resource/attach/submit',
    method: 'post',
    data: row
  });
};

export const update = (row) => {
  return request({
    url: '/api/blade-resource/attach/submit',
    method: 'post',
    data: row
  });
};

export const downLoad = (url) => {
  return request({
    responseType: 'blob',
    url: '/api/blade-resource/attach/read-attach',
    method: 'post',
    data: url
  });
};

export const getQmsTemplateFile = (params) => {
  return request({
    url: '/api/mes-product/qms-inspection-document/download-template',
    method: 'get',
    params
  });
};

export function existFile(data) {
  return request({
    url: '/api/blade-resource/oss/endpoint/exist',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
}
